﻿<?xml version="1.0" encoding="utf-8" ?>
<AdoNetDataAccess connection="$DBConnection$" formatter="bizobj of CompanyMembership(costs,limits)">
	<Sql>
		SELECT
			m.id
			,m.name
			,c.id as costsId
			,c.description as costsDescription
			,c.isDefault as costsIsDefault
			,c.timeLength as costsTimeLength
			,c.timeType as costsTimeType
			,c.cost as costsCost
			,c.description as costsDescription
			,a.id as limitsId
			,a.limit as limitsMaxTotalArticles
			,a.size as limitsMaxTotalArticleSize
		FROM  MembershipCosts  c
			LEFT JOIN ArticleLimit a ON a.id = c.id
			INNER JOIN CompanyMemberships m ON c.membershipId = m.id
			INNER JOIN Users u ON u.membershipId = c.id
		WHERE u.id= @id 
	</Sql>
	<Param name="id" type="UniqueIdentifier" />
</AdoNetDataAccess>

